﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework.AppContainer;
using UnitTestWinRTConverters.ObjectsTestBase;
using WinRTConverters.Boolean;
using WinRTConverters.Format;
using Assert = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.Assert;

namespace UnitTestWinRTConverters
{
    [TestClass]
    public class BooleanConvertersUnitTest
    {
        [UITestMethod]
        public void InvertBooleanConverterTest()
        {
            var objectTest = new UITextBlockTest(new InvertBooleanConverter(), true);
            Assert.AreEqual(false, Convert.ToBoolean(objectTest.ConvertValue));
        }

        [UITestMethod]
        public void ValueNotEqualNullToBooleanConverterTest()
        {
            var objectTest = new UITextBlockTest(new ValueNotEqualNullToBooleanConverter(), null);
            Assert.AreEqual(false, Convert.ToBoolean(objectTest.ConvertValue));

            var objectTestTrue = new UITextBlockTest(new ValueNotEqualNullToBooleanConverter(), new object());            
            Assert.AreEqual(true, Convert.ToBoolean(objectTestTrue.ConvertValue));

            var objectTestInvert = new UITextBlockTest(new ValueNotEqualNullToBooleanConverter(), null, true);
            Assert.AreEqual(true, Convert.ToBoolean(objectTestInvert.ConvertValue));

            var objectTestInvertFalse = new UITextBlockTest(new ValueNotEqualNullToBooleanConverter(), new object(), true);
            Assert.AreEqual(false, Convert.ToBoolean(objectTestInvertFalse.ConvertValue));
        }
    }
}
